summaryrefslogtreecommitdiff
path: root/app/[lng]/partners/(partners)/document-list/layout.tsx
blob: a75cdf7dbfbc072e5ae4dfed5fe2572d8f1c5c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

import { cookies } from "next/headers"
import { Shell } from "@/components/shell"
import DocumentContainer from "@/components/documents/document-container"
import { getVendorProjectsAndContracts } from "@/lib/vendor-data/services"
import { getVendorDocumentLists } from "@/lib/vendor-document/service"
import VendorDocumentsClient from "@/components/documents/vendor-docs.client"
import VendorDocumentListClient from "@/components/document-lists/vendor-doc-list-client"



// Layout 컴포넌트는 서버 컴포넌트입니다
export default async function VendorDocuments({
  children,
}: {
  children: React.ReactNode
}) {
  // const session = await getServerSession(authOptions)
  // const vendorId = session?.user.companyId
  const vendorId = "17"
  const idAsNumber = Number(vendorId)

  const projects = await getVendorProjectsAndContracts(idAsNumber)


  // 레이아웃 설정 쿠키 가져오기
  // Next.js 15에서는 cookies()가 Promise를 반환하므로 await 사용
  const cookieStore = await cookies()

  // 이제 cookieStore.get() 메서드 사용 가능
  const layout = cookieStore.get("react-resizable-panels:layout:mail")
  const collapsed = cookieStore.get("react-resizable-panels:collapsed")

  const defaultLayout = layout ? JSON.parse(layout.value) : undefined
  const defaultCollapsed = collapsed ? JSON.parse(collapsed.value) : undefined


  return (
    <Shell className="gap-2">
      <VendorDocumentListClient projects={projects}>
        {children}
      </VendorDocumentListClient>
    </Shell>
  )
}